<?php
namespace Home\Controller;
use Think\Controller;
class PublicController extends Controller{
	public function login(){
		$this->display("login");
	}
	public function checkLogin(){
// 		dump($_REQUEST);
		
		$name=$_REQUEST["name"];
		$p=$_REQUEST["password"];
		$password = md5("$p");
// 		echo $password;
		$mana = M("Manage")->where("name = '$name' and password = '$password'")->find();
// 		cookie("manager_id",$mana["id"],3600);
// 		dump($_COOKIE);
		dump($mana);
		if($mana){
			$_SESSION['manager']['name']=$mana["managename"];
			$_SESSION['manager']['id']=$mana["id"];
			cookie("manager_id",$mana["id"],3600);
			dump($_SESSION);exit;
			$index =new IndexController();
			$index->index();
		}else{
			$this->error("用户名或密码错误",login,2);
		}
	}
	public function logout(){
		cookie('manager_id',null);
		$_SESSION["mananger"] = null;
		$this->login();
	}
}